<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
{eval $user=$this->user; $setting=$this->setting;}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Tipask's Control Panel</title>
<meta http-equiv="Content-Type" content="text/html; charset={TIPASK_CHARSET}">
<link media="all" type="text/css" href="css/common/admin/admincp.css" rel="stylesheet" />
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/dialog.js" type="text/javascript"></script>
<script src="js/admin.js" type="text/javascript"></script>
<script src="js/calendar.js" type="text/javascript"></script>
</head>

<body>

<div id="append">
</div>

<div class="container">
	<!--{if isset($message)}-->
		<!--{eval $type=isset($type)?$type:'correctmsg'; }-->
		<div class="{$type}"><p>{$message}</p></div>
	<!--{/if}-->
	<div class="hastabmenu">
		<ul class="tabmenu">
			<li  id="srchuserbtn">
			<a  href="index.php?admin_question/default{$setting['seo_suffix']}">问题搜索</a></li>
			<li class="tabcurrent" id="adduserbtn"><a href="index.php?admin_question/searchanswer{$setting['seo_suffix']}">回答搜索</a></li>
		</ul>
		<div class="tabcontentcur" id="srchuserdiv">
			<form action="index.php?admin_question/searchanswer{$setting['seo_suffix']}" method="post">
				<table width="100%">
					<tr>
						<td>标题:</td>
						<td><input class="txt" name="srchtitle" /></td>
						<td>回答时间:</td>
						<td><input class="txt" onclick="showcalendar();" name="srchdatestart" />到&nbsp;<input class="txt" onclick="showcalendar();" name="srchdateend" /></td>
					</tr>
					<tr>
						<td>回答者:</td>
						<td><input class="txt" name="srchauthor" /></td>
						<td>关键字</td>
						<td><input type="text" name="keywords" size="30" maxlength="50"/></td>
					</tr>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td colspan="3"><input class="btn" name="submit" type="submit" value="提 交"></td>
					</tr>
					<tr>
					</tr>
				</table>
			</form>
		</div>
	</div>
	<br /><br /><br />
	<h4>[共 {$rownum} 条回答]</h4>
	<div class="mainbox">
		<form name="answerlist" method="post">
			<table class="datalist fixwidth">
				<tr>
					<th><input class="checkbox" id="chkall" onclick="checkall('aid[]')" type="checkbox" name="chkall"><label for="chkall">全选</label></th>
					<th>回答内容</th>
					<th>回答人</th>
					<th>回答时间</th>
					<th>投票选项</th>
					<th>是否被采纳</th>
					<th>已审核</th>
				</tr>
				{if isset($answerlist)} {loop $answerlist $answer}
				<tr>
					{eval $content=htmlspecialchars($answer['content']);}
					<td class="option"><input type="hidden" id="cont_{$answer['id']}" value="{$content}"/><input class="checkbox" type="checkbox" value="{$answer['id']}" name="aid[]"></td>
					<td id="title_{$answer['id']}"><a href="index.php?question/view/{$answer['qid']}{$setting['seo_suffix']}"  target="_blank">查看问题</a><br/>{$answer['content']}</td>
					<td><a href="index.php?user/space/{$answer['authorid']}{$setting['seo_suffix']}" target="_blank">{$answer['author']}</a></td>
					<td>{$answer['time']}</td>
					<td>{if $answer['voted']}<font color="Red">是</font>{else}否{/if}</td>
					<td>{if $answer['adopttime']}<img title="已被采纳为最佳答案" src="{SITE_URL}css/common/icn_2.gif">{else}否{/if}</td>
					<td>{if $answer['status']}<font color="Red">是</font>{else}否{/if}</td>
				</tr>
				{/loop} {/if}
				<tr class="nobg">
					<td class="tdpage" colspan="7">	<div class="pages">	{$departstr}</div></td>
				</tr>
				<tr class="nobg">
					<td colspan="7"><input class="btn" type="button" value="审核" onclick="verifyansw()"/>&nbsp;&nbsp;&nbsp;<input class="btn" type="button" value="修改内容" onclick="editcont()"/>&nbsp;&nbsp;&nbsp;<input class="btn" type="button" name="delete" value="删除" onclick="deleteanswer();" /></td>
				</tr>
			</table>
		</form>
	</div>
</div>
</body>
<script charset="utf-8" src="js/editor/kindeditor.js"></script>
<script type="text/javascript">
function editcont(){
		if ($("input[name='aid[]']:checked").length > 1){
			alert('只能同时对一个回答进行操作！');
			return false;
		}else if($("input[name='aid[]']:checked").length == 0){
			alert('你没有选择任何回答');
			return false;
		}else{
			var aid = $("input[name='aid[]']:checked").val();
			var content = $('#cont_'+aid).val();
			var title = $('#title_'+aid).text();
			$.dialog({
			    id:'editanswerDiv',
			    position:'center',
			    align:'left',
			    fixed:1,
			    width:600,
			    title:'修改问题内容',
			    fnOk:function(){document.editanswerForm.submit();$.dialog.close('editanswerDiv')},
			    fnCancel:function(){$.dialog.close('editanswerDiv')},
			    content:'<div>问题标题：'+title+'<br /><form name="editanswerForm"  action="index.php?admin_question/editanswercont{$setting['seo_suffix']}" method="post" ><textarea id="mc" name="content" style="width: 95%; padding-top: 1px; font-size: 14px;" rows="10" >'+content+'</textarea><input type="hidden"  value="'+aid+'" name="aid"/></form></div>'
			  });
			KE.init({
				id : 'mc',
				resizeMode : 1,
				allowUpload : false,
				newlineTag : 'br',
				items : [
				'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
				'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
				'insertunorderedlist', '|', 'image', 'link']
			});
			KE.create('mc');
		}
}
function deleteanswer(){
	if($("input[name='aid[]']:checked").length == 0){
		alert('你没有选择任何回答');
		return false;
	}
	if(confirm('确定删除回答?')==false){
		return false;
	}
	document.answerlist.action="index.php?admin_question/deleteanswer{$setting['seo_suffix']}";
	document.answerlist.submit();
}

function verifyansw(){
	if($("input[name='aid[]']:checked").length == 0){
		alert('你没有选择任何回答');
		return false;
	}
	document.answerlist.action="index.php?admin_question/verifyanswer{$setting['seo_suffix']}";
	document.answerlist.submit();		
}
</script>

</html>
